package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JTextArea;
import java.awt.Font;
import javax.swing.JScrollPane;
import java.awt.Dimension;

public class VDatosVideoLista extends JPanel {
	private JTextField tfTitulo;
	private JTextField ftFile;
	private JTextArea taDescripcion;
	private JButton btnExaminar;

	/**
	 * Create the panel.
	 */
	public VDatosVideoLista() {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{65, 93, 86, 0, 0};
		gridBagLayout.rowHeights = new int[]{46, 41, 23, 100, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JLabel lblTtulo = new JLabel("T\u00EDtulo");
		GridBagConstraints gbc_lblTtulo = new GridBagConstraints();
		gbc_lblTtulo.insets = new Insets(0, 0, 5, 5);
		gbc_lblTtulo.gridx = 0;
		gbc_lblTtulo.gridy = 1;
		add(lblTtulo, gbc_lblTtulo);
		
		tfTitulo = new JTextField();
		GridBagConstraints gbc_tfTitulo = new GridBagConstraints();
		gbc_tfTitulo.fill = GridBagConstraints.HORIZONTAL;
		gbc_tfTitulo.insets = new Insets(0, 0, 5, 5);
		gbc_tfTitulo.gridx = 1;
		gbc_tfTitulo.gridy = 1;
		add(tfTitulo, gbc_tfTitulo);
		tfTitulo.setColumns(10);
		
		ftFile = new JTextField();
		ftFile.setEditable(false);
		ftFile.setEnabled(false);
		ftFile.setVisible(false);
		GridBagConstraints gbc_ftFile = new GridBagConstraints();
		gbc_ftFile.insets = new Insets(0, 0, 5, 5);
		gbc_ftFile.gridx = 2;
		gbc_ftFile.gridy = 1;
		add(ftFile, gbc_ftFile);
		ftFile.setColumns(10);
		
		btnExaminar = new JButton("Examinar");
		btnExaminar.setBounds(168, 5, 81, 25);
		btnExaminar.setVisible(false);
		btnExaminar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
				JFileChooser chooser = new JFileChooser();
				chooser.setCurrentDirectory(new java.io.File("."));
				chooser.setDialogTitle("Seleccione un video");
				if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
					ftFile.setText(chooser.getSelectedFile().getName());
					//copy(chooser.getSelectedFile());
					//btnAceptar.setEnabled(true);
				}
			}

		});
		GridBagConstraints gbc_btnExaminar = new GridBagConstraints();
		gbc_btnExaminar.insets = new Insets(0, 0, 5, 0);
		gbc_btnExaminar.gridx = 3;
		gbc_btnExaminar.gridy = 1;
		this.add(btnExaminar, gbc_btnExaminar);
		
		VSelecTema selecTema = new VSelecTema();
		GridBagConstraints gbc_selecTema = new GridBagConstraints();
		gbc_selecTema.gridwidth = 2;
		gbc_selecTema.gridheight = 3;
		gbc_selecTema.anchor = GridBagConstraints.NORTHWEST;
		gbc_selecTema.insets = new Insets(0, 0, 0, 5);
		gbc_selecTema.gridx = 0;
		gbc_selecTema.gridy = 2;
		add(selecTema, gbc_selecTema);
		
		JLabel lblNewLabel = new JLabel("Descripci\u00F3n");
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.anchor = GridBagConstraints.WEST;
		gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel.gridx = 2;
		gbc_lblNewLabel.gridy = 2;
		add(lblNewLabel, gbc_lblNewLabel);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setPreferredSize(new Dimension(170, 100));
		GridBagConstraints gbc_scrollPane = new GridBagConstraints();
		gbc_scrollPane.fill = GridBagConstraints.BOTH;
		gbc_scrollPane.gridwidth = 2;
		gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
		gbc_scrollPane.gridx = 2;
		gbc_scrollPane.gridy = 3;
		add(scrollPane, gbc_scrollPane);
		
		taDescripcion = new JTextArea();
		scrollPane.setViewportView(taDescripcion);
		taDescripcion.setLineWrap(true);

	}

	public JButton getBtnExaminar() {
		return btnExaminar;
	}
	public JTextField getFtFile() {
		return ftFile;
	}
}
